package hbt;

import org.hibernate.SessionFactory;
import org.hibernate.cfg.AnnotationConfiguration;

import entity.ClienteEntity;
import entity.CondicionCompraEntity;
import entity.CotizacionEntity;
import entity.DocumentoEntity;
import entity.DomicilioEntity;
import entity.FacturaEntity;
import entity.GananciaEntity;
import entity.ItemEntity;
import entity.ItemListado;
import entity.ListadoPecioEntity;
import entity.OrdenCompraEntity;
import entity.OrdenPedidoEntity;
import entity.ProveedorEntity;
import entity.RemitoEntity;
import entity.RodamientoEntity;
import entity.SolicitudCotizacionEntity;
import entity.StockEntity;

public class HibernateUtil {
	 private static final SessionFactory sessionFactory;
	    static
	    {
	        try
	        {
	        	 AnnotationConfiguration config = new AnnotationConfiguration();
	        	 config.addAnnotatedClass(CondicionCompraEntity.class);
	        	 config.addAnnotatedClass(DomicilioEntity.class);
	        	 config.addAnnotatedClass(ClienteEntity.class);
	        	 config.addAnnotatedClass(DocumentoEntity.class);
	        	 config.addAnnotatedClass(CotizacionEntity.class);
	        	 config.addAnnotatedClass(FacturaEntity.class);
	        	 config.addAnnotatedClass(ListadoPecioEntity.class);
	        	 config.addAnnotatedClass(OrdenCompraEntity.class);
	        	 config.addAnnotatedClass(OrdenPedidoEntity.class);
	        	 config.addAnnotatedClass(ProveedorEntity.class);
	        	 config.addAnnotatedClass(RemitoEntity.class);
	        	 config.addAnnotatedClass(RodamientoEntity.class);
	        	 config.addAnnotatedClass(SolicitudCotizacionEntity.class);
	        	 config.addAnnotatedClass(ItemEntity.class);
	        	 config.addAnnotatedClass(ItemListado.class);
	        	 config.addAnnotatedClass(StockEntity.class);
	        	 config.addAnnotatedClass(GananciaEntity.class);
	        	 
	             sessionFactory = config.buildSessionFactory();
	        }
	        catch (Throwable ex)
	        {
	            System.err.println("Initial SessionFactory creation failed." + ex);
	            throw new ExceptionInInitializerError(ex);
	        }
	    }
	 
	    public static SessionFactory getSessionFactory()
	    {
	        return sessionFactory;
	    }
	}



